package com.itheima;

import com.itheima.config.SpringConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import javax.sql.DataSource;
import java.sql.SQLException;

public class App {
    public static void main(String[] args) throws SQLException {
        //获取核心容器对象
        ApplicationContext app = new AnnotationConfigApplicationContext(SpringConfig.class);
        DataSource ds = (DataSource) app.getBean("dataSource");
        System.out.println(ds.getConnection());
    }
}
